<?php
/**
 * @user:andy
 * @date:2021/7/31
 * @company:http://www.sjdphp.com
 * @desc:
 */

namespace app\admin\validate;


use think\Validate;

class InvValidate extends Validate
{
    protected $rule = [
        'inv_id'    => 'require|number',
        'inv_title' => 'require',
        'plate_id'       => 'require|number',
        'inv_type'  => ['require','number','in' => '1,2'],
        'author'    => 'require',
        'inv_content' => 'require',
    ];

    protected $message = [
        'inv_id.require' => '帖子ID不能为空',
        'inv_id.number'  => '帖子ID格式错误',
        'inv_title.require' => '帖子标题不能为空',
        'plate_id.require'       => '所属板块不能为空',
        'plate_id.number'        => '所属板块格式错误',
        'inv_type.require'  => '帖子来源不能为空',
        'inv_type.number'   => '帖子来源格式错误',
        'inv_type.in'       => '帖子参数不合法',
        'author.require'    => '帖子作者不能为空',
        'inv_content.require' => '帖子内容不能为空',
    ];

    protected $scene = [
        'add'  => ['inv_title','plate_id','inv_type','author','inv_content'],
        'edit' => ['inv_title','plate_id','inv_type','author','inv_content','inv_id'],
    ];
}